import { TransitionOut } from "@/framework/core/Transition";
import CanvasScreen from "@/framework/ui/canvas/CanvasScreen";

export default class FadeOut extends TransitionOut {
  init(): void {
    if(this.screen instanceof CanvasScreen) {
      this.screen.globalAlpha = 1
    }
  }
  destroy(): void {
    if(this.screen instanceof CanvasScreen) {
      this.screen.globalAlpha = 0
    }
  }
  update(dt: number): void {
    if(this.screen instanceof CanvasScreen) {
      this.screen.globalAlpha = 1 - this.progress
    }
    this.screen.update(dt)
  }
}
